<template>
  <div style="height:750px">
    <div class="Echarts">
      <div id="main" style="width: 600px;height:400px; margin:auto"></div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  mounted() {
    this.datas();
  },

  methods: {
    datas() {
      this.$axios({
        method: "get",
        url: "/nces/ncesOlders",
      })
        .then((res) => {
          console.log(res);
          let datas = [];
          datas = res.data.result.olderCount;

          console.log(datas);

          var myChart = this.$echarts.init(document.getElementById("main"));
          var option = {
            title: {
              text: "工单统计",
            },
            tooltip: {},
            legend: {
              data: ["工单数量"],
            },
            xAxis: {
              data: ["受理中", "处理中", "已完成", "已驳回"],
            },
            yAxis: {},
            series: [
              {
                name: "工单数量",
                type: "bar",
                data: datas,
              },
            ],
          };
          myChart.setOption(option);
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style></style>
